<?php

namespace app\api\model;


use app\admin\model\ttk\Player;
use app\admin\model\User;

class TkPlayer
{

    public static function createPlayer(int $roomId,User $user,int $pos,int $role): Player
    {
        if ($role == Enum::Role_ZhuGong) {
            echo '分配角色给玩家(主公)' . $user['id'] . PHP_EOL;;
        } else {
            echo '分配角色给玩家' . $user['id'] . PHP_EOL;;
        }
        return Player::create([
            'name' => '巅峰玩家',
            'ttk_room_id' => $roomId,
            'user_id' => $user['id'],
            'pos' => $pos,
            'role' => $role,
            'die' => Enum::RoleStatus_Normal,
            'life' => 0,
        ]);


    }


}